import {Component, OnInit} from '@angular/core';
import {Product, ProductService} from '../../../service/product/product.service';

@Component({
  selector: 'app-product1',
  templateUrl: './product1.component.html',
  styleUrls: ['./product1.component.css']
})
export class Product1Component implements OnInit {

  product: Product;

  /*ProductService 是令牌 找出对应的实例化对象*/
  constructor(private productService: ProductService) {
  }

  ngOnInit() {
    this.product = this.productService.getProduct();
  }

}
